import {
  AppTemplateResp,
  TenantByAppListReq,
  TenantByAppListResp,
  TenantListResp,
} from './model/commonModel';
import { deployHttp, operationHttp, tenantHttp } from '/@/utils/http/axios';

enum Api {
  GET_APP_SELECT_LIST = '/v1/app/apps',
  GET_TENANT_SELECT_LIST = '/tenant/getTenantNameList',
  GET_TENANT_LIST_BY_APP = '/v1/subAnalysis/getTenantsOfApp',
}

export const getAppSelectList = () => {
  return deployHttp.get<AppTemplateResp[]>({ url: Api.GET_APP_SELECT_LIST });
};

export const getTenantSelectList = () => {
  return tenantHttp.get<TenantListResp[]>({ url: Api.GET_TENANT_SELECT_LIST });
};

export const getTenantListByApp = (params: TenantByAppListReq) => {
  return operationHttp.get<TenantByAppListResp[]>({ url: Api.GET_TENANT_LIST_BY_APP, params });
};
